import request from '@/utils/request'

// 查询退货出库列表
export function listBackOutStart(query) {
  return request({
    url: '/output/backOutStart/list',
    method: 'get',
    params: query
  })
}

// 查询退货出库详细
export function getBackOutStart(ctmId) {
  return request({
    url: '/output/backOutStart/' + ctmId,
    method: 'get'
  })
}

// 新增退货出库
export function addBackOutStart(data) {
  return request({
    url: '/output/backOutStart',
    method: 'post',
    data: data
  })
}

//获取需要添加的数据
export function getNeedData(query) {
  return request({
    url: '/output/backOutStart/getNeedData',
    method: 'get',
    params:query
  })
}

//添加数据
export function addCtmMstr(data) {
  return request({
    url: '/output/backOutStart/addCtmMstr',
    method: 'post',
    data: data
  })
}

// 删除退货出库
export function delBackOutStart(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/' + ctmDjbhs,
    method: 'delete'
  })
}
// 提交单据
export function submitCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/submitCtm/' + ctmDjbhs,
    method: 'post'
  })
}


// 导出退货出库
export function exportBackOutStart(query) {
  return request({
    url: '/output/backOutStart/export',
    method: 'get',
    params: query
  })
}

// 修改退货出库
export function updateBackOutStart(data) {
  return request({
    url: '/output/backOutStart',
    method: 'put',
    data: data
  })
}

//厂商确认、批量厂商确认
export function vToConfirm(ctmDjbhs,ctmThCs,ctmThrq) {
  return request({
    url: '/output/backOutStart/vToConfirm/'+ctmDjbhs+'/'+ctmThCs+'/'+ctmThrq,
    method: 'put'
  })
}
//审核单据
export function checkCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/checkCtm/'+ctmDjbhs,
    method: 'put'
  })
}
export function checkBackCtm(ctmDjbhs,backReson) {
  return request({
    url: '/output/backOutStart/checkBackCtm/'+ctmDjbhs+'/'+backReson,
    method: 'put'
  })
}
export function permitBackCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/permitBackCtm/'+ctmDjbhs,
    method: 'put'
  })
}
export function permitCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/permitCtm/'+ctmDjbhs,
    method: 'put'
  })
}
export function postCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/postCtm/'+ctmDjbhs,
    method: 'put'
  })
}
export function finishBackCtm(ctmDjbhs) {
  return request({
    url: '/output/backOutStart/finishBackCtm/'+ctmDjbhs,
    method: 'put'
  })
}

export function ctmReportList(query){
  return request({
    url: '/output/backOutStart/ctmReportList',
    method: 'get',
    params: query
  })
}
export function ctmReportExcel(query){
  return request({
    url: '/output/backOutStart/ctmReportExcel',
    method: 'get',
    params: query
  })
}

